package top.kaoshanji.r2ch07f;

import org.springframework.context.ApplicationContext;
import org.springframework.context.support.ClassPathXmlApplicationContext;
import top.kaoshanji.r2ch07e.ForumService;
import top.kaoshanji.r2ch07e.Monitorable;

/**
 * 代码清单-r2ch07f-01：测试一下引介增强
 * @author kaoshanji
 * ^_^
 * create time 2025/5/7 18:43
 */
public class GreetingIntroduceAdvisorContext {

    public static void main(String[] args) {

        ApplicationContext context = new ClassPathXmlApplicationContext("r2ch07f/greeting-introduce-advisor-beans.xml");
        ForumService forumService = (ForumService)context.getBean("forumService");

        // 默认情况下，未开启性能监视功能
        forumService.removeForum(10);
        forumService.removeTopic(1022);

        System.out.println("=======================");

        // 开启性能监视功能
        Monitorable monitorable = (Monitorable)forumService;
        monitorable.setMonitorActive(true);

        forumService.removeForum(10);
        forumService.removeTopic(1022);

    }

}
